package com.yanqu.road.server.manger;

import com.yanqu.road.dao.impl.servercenter.AppIdPlatformPolicyDaoImpl;
import com.yanqu.road.entity.servercenter.AppIdPlatformPolicy;
import com.yanqu.road.server.TempMgr;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author ：zfr
 * @date ：2021/11/30 11:49
 */
public class AppIdPlatformPolicyMgr extends TempMgr {
    //根据子渠道不同的隐私协议
    private static Map<String, AppIdPlatformPolicy> appIdPlatformPolicy = new ConcurrentHashMap<>();

    @Override
    public boolean init() throws Exception {
        return reload();
    }

    @Override
    public boolean reloadConfig() throws Exception {
        return true;
    }

    @Override
    public boolean reloadData() throws Exception {
        appIdPlatformPolicy = new AppIdPlatformPolicyDaoImpl().getAppIdPlatformPolicy();
        return true;
    }


    public static AppIdPlatformPolicy getAppIdPlatformPolicy(String appId) {
        AppIdPlatformPolicy platformPolicy = appIdPlatformPolicy.get(appId);
        return platformPolicy;
    }

    @Override
    public boolean stop() {
        return false;
    }
}
